import { defineComponent, onMounted, ref } from 'vue'
import { ElCard } from 'element-plus'
import { useStore } from 'vuex'

export default defineComponent(function Home() {
  const store = useStore()
  type IframeHTMLAttributes = any
  const ifSrc = ref<IframeHTMLAttributes>('')
  const init = async () => {
    const res = await store.dispatch('user/GetMenu')
    if (res.length > 0) {
      res.forEach((item: any) => {
        if (item.children.length > 0) {
          item.children.forEach((row: any) => {
            if (row.path === '/basestation/overview') {
              ifSrc.value = row.remark
            }
          })
        }
      })
    }
  }

  onMounted(() => {
    init()
  })

  return () => (
    <ElCard>
      <iframe style="width: 100%; height: 100vh;" frameborder="0" src={ifSrc.value}></iframe>
    </ElCard>
  )
})
